﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MastePage/SubEmptyMaster.Master" AutoEventWireup="true" CodeBehind="QueryMBOMMaterial.aspx.cs" Inherits="BySoft.Web.Site.ComPage.QueryMBOMMaterial" %>

<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlace" runat="server">
    <script language="javascript" type="text/javascript">
        function CheckAll(con) {
            var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");

             for (i = 0; i < dom.length; i++) {
                 if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                     dom[i].checked = document.getElementById(con.id).checked;
                 }
             }
         }

         function CheckSingle(con) {
             var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");
             if (!document.getElementById(con.id).checked) {
                 for (i = 0; i < dom.length; i++) {
                     if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                         dom[i].checked = false;
                         break;
                     }
                 }
             }
             else {
                 var choose = true;
                 var first = true;
                 for (i = 0; i < dom.length; i++) {
                     if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                         if (first == false) {
                             if (dom[i].checked == false) {
                                 choose = false;
                                 break;
                             }
                         }
                         else {
                             first = false;
                         }
                     }
                 }

                 for (i = 0; i < dom.length; i++) {
                     if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                         dom[i].checked = choose;
                         break;
                     }
                 }
             }
         }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="EmptyMasteCPH" runat="server">
    <br />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <%--查询条件--%>
            <div class="searchTable">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <th class="left2">原料编号：
                        </th>
                        <td class="right2">
                            <asp:TextBox CssClass="fullWidth" ID="txtMaterialID" runat="server"></asp:TextBox>
                        </td>
                        <th class="left2">原料名称：
                        </th>
                        <td class="right2">
                            <asp:TextBox CssClass="fullWidth" ID="txtMaterialName" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <div class="btnStylef">
                    <label class="btnStyleb png_bg">
                        <asp:Button Text="查询" runat="server" ID="btnQuery" OnClick="btnQuery_Click" />
                    </label>
                </div>
            </div>
            <%--列表--%>
            <div class="tableStyle">
                <asp:SGridView runat="server" ID="grdResult" Width="100%" ShowActionToolBar="false"
                    AutoGenerateColumns="false" AllowCascade="false">
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="cbAll" runat="server" onclick="CheckAll(this)" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbChoose" runat="server" onclick="CheckSingle(this)" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                是否直接材料
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblIsDirect" CssClass="Hidden" runat="server" Text='<%#Eval("IsDirect") %>'></asp:Label>
                                <asp:Label ID="lblIsDirectName" runat="server" Text='<%#Eval("IsDirectName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                原料编号
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblMaterialID" runat="server" Text='<%#Eval("MaterialID") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                原料名称
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblMaterialName" runat="server" Text='<%#Eval("MaterialName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                规格
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblSpecifications" runat="server" Text='<%#Eval("Specifications") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                单位
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblUnit" runat="server" Text='<%#Eval("Unit") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                长
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblLong" runat="server" Text='<%#Eval("Long") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                宽
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblWidth" runat="server" Text='<%#Eval("Width") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                高
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblHeight" runat="server" Text='<%#Eval("Height") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                外径
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblOutSide" runat="server" Text='<%#Eval("OutSide") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                内径
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblInSide" runat="server" Text='<%#Eval("InSide") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:SGridView>
                <div style="padding-top: 5px" align="right">
                    <cc1:PagingControl ID="pcData" runat="server" OnPageIndexClick="pcData_PageIndexClick" />
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="tableStyle2">
        <div class="controlBar" style="padding-right: 300px;">
            <label class="btnStylec png_bg">
                <asp:Button ID="btnOk" CssClass="png_bg" runat="server" Text="确认" OnClick="btnOk_Click" /></label>
            <label class="btnStylec png_bg">
                <input id="btnBack" type="button" class="png_bg" value="取消" onclick="CloseTopDialog();" /></label>
        </div>
    </div>
</asp:Content>


